import { createStore, combineReducers } from 'redux'

import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'
import { collapsedReducer } from './ruducer/collapsedReducer'
import { loadingReducer } from './ruducer/loadingReducer'

const reducer = combineReducers({
  collapsedReducer,
  loadingReducer,
})

const persistConfig = {
  key: 'root',
  storage,
  blacklist: ['loadingReducer'],
}

const persistedReducer = persistReducer(persistConfig, reducer)

const store = createStore(persistedReducer)
const persistor = persistStore(store)

export { store, persistor }
